package com.etc.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.etc.dao.JobMapper;
import com.etc.entity.Company;
import com.etc.entity.CompanyPinYin;
import com.etc.entity.Job;
import com.etc.entity.LayUiData;
import com.etc.service.JobService;
@Service
public class JobServiceImpl implements JobService {
	@Autowired
	private JobMapper mapper;
	@Autowired
	private JobService js;

	
	/**
	 * 查询所有职位
	 * @return
	 */
	
	@Override
	public List<Job> queryAlljob() {
		// TODO Auto-generated method stub
		
		return mapper.queryAlljob();
	}

	
	
	/**
	 * 查询所有职位的数量
	 * @return
	 */
	@Override
	public int queryAlljobNub() {
		// TODO Auto-generated method stub
		return mapper.queryAlljobNub();
	}

	
	/**
	 * 增加一个职位
	 * @param job
	 * @return
	 */
	@Override
	public int addJob(Job job) {
		// TODO Auto-generated method stub
		return mapper.addJob(job);
	}

	
	
	/**
	 * 删除某个职位，根据id
	 * @param jobId
	 * @return
	 */
	@Override
	public int delJob(int jobId) {
		// TODO Auto-generated method stub
		return mapper.delJob(jobId);
	}

	
	/**
	 * 根据公司id查询职位
	 * @param job
	 * @return
	 */
	@Override
	public List<Job> queryCompJob(int comId) {
		// TODO Auto-generated method stub
		return mapper.queryCompJob(comId);
	}

	
	/**
	 * 修改职位信息
	 * @param job
	 * @return
	 */
	@Override
	public boolean updataJob(Job job) {
		// TODO Auto-generated method stub
		
		
		return mapper.updataJob(job);
	}

	
	/**
	 * 根据职位名称查询
	 * @param jobName
	 * @return
	 */
	@Override
	public List<Job> JobLikeName(int start, int limit, String jobname) {
		// TODO Auto-generated method stub
		return mapper.JobLikeName(start, limit, jobname);
	}

	
	
	/**
	 * 根据类型名称查询
	 * @param jobName
	 * @return
	 */
	@Override
	public List<Job> JobLikeType(int start, int limit, String jobCategory) {
		// TODO Auto-generated method stub
		return mapper.JobLikeType(start, limit, jobCategory);
	}

	
	/**
	 * 根据职位的相同数量的和进行排序（热度
	 * @return
	 */
	@Override
	public List<Job> jobnamepaixu() {
		// TODO Auto-generated method stub
		return mapper.jobnamepaixu();
	}
	
	
	@Override
	public List<Company> comPinYinComName(CompanyPinYin yin) {
		// TODO Auto-generated method stub
		
	
		
		return mapper.comPinYinComName(yin);
	}
	
	
	@Override
	public List<Company> comPinCityName(CompanyPinYin yin) {
		// TODO Auto-generated method stub
		return mapper.comPinCityName(yin);
	}
	
	@Override
	public LayUiData<Job> getJobByLike(int page, int limit, String strLike) {
		// TODO Auto-generated method stub
		int start = (page - 1) * limit;
		LayUiData<Job> laydata = new LayUiData<Job>();
		List<Job> list = mapper.JobLikeName(start, limit, strLike);
		laydata.setCode(0);
		laydata.setMsg("");
		laydata.setCount(mapper.getJobCount());
		laydata.setData(list);
		return laydata;
	}
	
	@Override
	public List<Company> comIdName(String comCity) {
		// TODO Auto-generated method stub
		return mapper.comIdName(comCity);
	}
	
	@Override
	public List<Job> jobListsName(String comCity) {
		// TODO Auto-generated method stub
		return mapper.jobListsName(comCity);
	}
	

}
